package com.imooc.smartcabinet.ui;

import javax.swing.*;
import java.awt.*;

public class MqttClientPanel extends JPanel {
    JFrame mainFrame = null;
    JTextField topicText;
    JButton subButton;//订阅按钮

    public MqttClientPanel(JFrame frame) {
        this.mainFrame = frame;
        init();
    }

    public MqttClientPanel() {
        init();
    }

    public void init() {
        JPanel top = new JPanel(new FlowLayout(FlowLayout.LEFT));
        top.setBounds(new Rectangle(700, 50));
        JLabel title = new JLabel("Topic:");
        top.add(title);
        topicText = new JTextField();
        topicText.setColumns(20);
        topicText.setBounds(new Rectangle(200, 28));
        top.add(topicText);
        subButton = new JButton("订阅");
        top.add(subButton);
        this.setLayout(new BorderLayout());
        this.add(top, BorderLayout.NORTH);
    }
}
